interface Ikun {
  name: string;
  age: number;
}

type IKunKeys = keyof Ikun; // name | age

const a: IKunKeys = "name";
const b: IKunKeys = "age";

// 传入的key类型，obj当中的key的其中之一
function getObjetProperty<O, K extends keyof O>(obj: O, key: K) {
  return obj[key];
}

const info = {
  name: "why",
  age: 18,
  height: 1.88,
};

const name = getObjetProperty(info, "name");

export {};
